<?php
N::loadClass('N_Model_Abstract');
class APP_Model_Admin_Category extends N_Model_Abstract
{
	public function add(string $name, int $parent, int $order = null)
	{
		$order = intval($order);
		
		return $this->insert(array('name'=>$name, 'parent'=>$parent, 'order'=>$order));
	}
	
	public function edit(int $id)
	{
		
	}
	
	/**
	public function delete(int $id, $checkChildren = true)
	{
		
	}
	*/
	
	public function deleteByName(string $name, $checkChildren = true)
	{
		
	}
	
	public function __construct()
	{
		$this->setTable('phpdata_category');
		$this->setPk('id');
	}
	
	public function getCategoryList()
	{
		return $this->findAll();
	}
}